import { InjectionKey } from "vue";
import { createStore, Store, useStore as baseUseStore } from "vuex";
import RootStateInterface, { AllStateTypes } from './types'
import workbranchModule from "./modules/workbranch";

export const key: InjectionKey<Store<RootStateInterface>> = Symbol();

export default createStore<RootStateInterface>({
  state: {
    language: 'CN'
  },
  modules: {
    workbranch: workbranchModule
  }
})

export function useStore<T = AllStateTypes>() {
  return baseUseStore<T>(key);
}

